package com.antbee.cms.ruili.spring.dao.hibernate;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.antbee.cms.ruili.hibernate.model.Saleinfo;
import com.antbee.cms.ruili.spring.dao.SaleInfoDAO;

public class SaleInfoDAOImpl extends HibernateDaoSupport implements SaleInfoDAO {

	public List GetAllSaleInfo() {		
		return this.getHibernateTemplate().find("from Saleinfo as a order by a.id");
	}

	public void DeleteSale(String PId) {
		Saleinfo sale = this.GetSaleInfo(PId);
		this.getHibernateTemplate().delete(sale);	
	}

	public Saleinfo GetSaleInfo(String PId) {
		List Lsql = this.getHibernateTemplate().find("from Saleinfo as a where a.id="+PId);
		if (Lsql.size()>=1){
			return (Saleinfo) Lsql.get(0);
		}
		return null;
	}
	

}
